package com.qm.console.component.sensitive.data;

import com.alibaba.fastjson.JSONArray;

import java.util.Arrays;

import lombok.Getter;
import lombok.Setter;

/**
 * //                       _oo0oo_
 * //                      o8888888o
 * //                      88" . "88
 * //                      (| -_- |)
 * //                      0\  =  /0
 * //                    ___/`---'\___
 * //                  .' \\|     |// '.
 * //                 / \\|||  :  |||// \
 * //                / _||||| -:- |||||- \
 * //               |   | \\\  -  /// |   |
 * //               | \_|  ''\---/''  |_/ |
 * //               \  .-\__  '-'  ___/-. /
 * //             ___'. .'  /--.--\  `. .'___
 * //          ."" '<  `.___\_<|>_/___.' >' "".
 * //         | | :  `- \`.;`\ _ /`;.`/ - ` : | |
 * //         \  \ `_.   \_ __\ /__ _/   .-` /  /
 * //     =====`-.____`.___ \_____/___.-`___.-'=====
 * //                       `=---='
 * //
 * //
 * //     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 * //
 * //               佛祖保佑         永无BUG
 * <p>
 * com.qm.console.component.sensitive.data
 * Created on 2021/8/5.
 */
@Getter
@Setter
public class SensitiveConfigDTO {
    private Long id;
    private String appId;
    private String category;
    private Integer isCommon;
    private String word;
    private Integer grade;
    private Integer state;

    public SensitiveConfigVO toVO() {
        SensitiveConfigVO result = new SensitiveConfigVO();
        result.setId(id);
        result.setAppId(appId);
        result.setCategory(category);
        result.setIsCommon(isCommon);
        if (word != null) {
            JSONArray temp = new JSONArray();
            String[] fucker = word.split(",");
            temp.addAll(Arrays.asList(fucker));
            result.setWord(temp);
        }
        result.setGrade(grade);
        result.setState(state);
        return result;
    }
}
